package com.itheima;

import java.util.Random;
import java.util.Scanner;
/*
* 猜数字游戏
* */
public class day03 {
    public static void main(String[] args) {
        int num = new Random().nextInt(100) + 1;
        //System.out.println("回答正确"+num);
        while (true){
            System.out.println("请输入您药材的数字(1-100):");
            int guessNum=new Scanner(System.in).nextInt();
            if (guessNum>100||guessNum<1){
                System.out.println("您猜的数字超出范围了!");
                continue;
            }else if(guessNum>num){
                System.out.println("猜大了");
            }else if(guessNum<num){
                System.out.println("猜小了");
            }else {
                System.out.println("恭喜你答对了");
                break;
            }
        }
    }
}
